package com.woniu.controller;

import com.woniu.entity.SysConfig;
import com.woniu.form.EditAvatarAndNicknameForm;
import com.woniu.form.SysConfigForm;
import com.woniu.service.SysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @Description:
 * @Author: woniu
 * @date: 2023/12/28 10:11
 */
@RestController("SysConfigController")
@RequestMapping("/sys/config")
@Api(tags = "系统配置")
public class SysConfigController {

    @Autowired
    private SysConfigService sysConfigService;

    @ApiOperation(value = "更新系统配置")
    @GetMapping("/edit")
    @ApiImplicitParams({})
    public boolean editConfig(SysConfigForm form){
        return sysConfigService.editConfig(form);
    }

    @ApiOperation(value = "新增系统配置")
    @PostMapping("/save")
    @ApiImplicitParams({})
    public boolean saveConfig(@RequestBody @Valid SysConfigForm form){
        return sysConfigService.saveConfig(form);
    }

    @ApiOperation(value = "获取最新系统配置")
    @GetMapping("/newest")
    @ApiImplicitParams({})
    public SysConfig newestConfig(@RequestParam("sign") String sign){
        return sysConfigService.newestConfig(sign);
    }


}
